var _n33;
var cc__extends = __extends;
var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
cc__decorator.property;
var def_RankMgr = function (t) {
  function _ctor() {
    var instance = null !== t && t.apply(this, arguments) || this;
    instance.cityRankData = [
      { cityName: "河南" },
      { cityName: "山东" },
      { cityName: "江苏" },
      { cityName: "河北" },
      { cityName: "安徽" },
      { cityName: "广东" },
      { cityName: "四川" },
      { cityName: "山西" },
      { cityName: "浙江" },
      { cityName: "湖北" },
      { cityName: "陕西" },
      { cityName: "湖南" },
      { cityName: "辽宁" },
      { cityName: "福建" },
      { cityName: "云南" },
      { cityName: "贵州" },
      { cityName: "新疆" },
      { cityName: "北京" },
      { cityName: "内蒙古" },
      { cityName: "江西" },
      { cityName: "甘肃" },
      { cityName: "黑龙江" },
      { cityName: "天津" },
      { cityName: "重庆" },
      { cityName: "吉林" },
      { cityName: "广西" },
      { cityName: "宁夏" },
      { cityName: "香港" },
      { cityName: "上海" },
      { cityName: "海南" },
      { cityName: "台湾" },
      { cityName: "西藏" },
      { cityName: "澳门" },
      { cityName: "青海" }
    ];

    instance.pers = [
      "0.084", "0.066", "0.059", "0.058", "0.050", "0.050",
      "0.045", "0.039", "0.036", "0.034", "0.034", "0.032",
      "0.030", "0.030", "0.029", "0.028", "0.026", "0.025",
      "0.023", "0.023", "0.020", "0.020", "0.019", "0.018",
      "0.017", "0.016", "0.013", "0.011", "0.010", "0.010",
      "0.010", "0.009", "0.009", "0.009", "0.008"
    ];

    instance.seed = null;
    return instance;
  }
  cc__extends(_ctor, t);
  _ctor.prototype.onLoad = function () { };
  _ctor.prototype.start = function () { };
  _ctor.prototype.getRankInfo = function () {
    var currentDate = new Date();
    var hours = currentDate.getHours();
    var minutes = currentDate.getMinutes();
    var targetDate = new Date("2024/3/1 00:00:00");

    var elapsedSeconds = (Number(currentDate) - Number(targetDate)) / 1000;
    var daysPassed = Math.max(0, parseInt(elapsedSeconds / 86400));

    var baseValue = 200000 + 20000 * daysPassed;
    baseValue += (20000 / 24) * hours;               // Daily adjustment based on hours
    baseValue += (20000 / 24 / 60) * minutes;       // Further adjustment based on minutes
    baseValue = parseInt(baseValue);

    this.seed = daysPassed + 10000;
    var randomNum = this.seededRandomRange(700, 1200);
    var calculatedValue = parseInt((baseValue * randomNum) / 1000000);

    console.log("tnum == succ_num ", baseValue, calculatedValue);

    // Rank cities
    var ranks = this.cityRankData.map((city, index) => {
      return {
        ...city,
        rank: index + 1,
        university: Math.floor(calculatedValue * Number(this.pers[index])) * daysPassed,
        grade: Math.floor(3.5 * (Math.floor(calculatedValue * Number(this.pers[index])) * daysPassed))
      };
    });

    // Shuffle city data sections
    var sections = [
      ranks.slice(0, 10),
      ranks.slice(10, 20),
      ranks.slice(20, 30),
      ranks.slice(30, 36)
    ].map(section => {
      this.shuffleArray(section);
      return section;
    });

    var finalRanks = sections.flat();

    return {
      cityRankInfo: finalRanks,
      dau: baseValue,
      succ_user: calculatedValue
    };
  };
  _ctor.prototype.seededRandom = function (t, e) {
    t = t || 1;         // 默认 t 为 1
    e = e || 0;         // 默认 e 为 0

    this.seed = (9301 * this.seed + 49297) % 233280;  // 更新随机种子
    return e + (this.seed / 233280) * (t - e);         // 计算并返回结果
  };
  _ctor.prototype.seededRandomRange = function (t, e) {
    var o = Math.max(t, e);
    var n = Math.min(t, e);
    return Math.round(this.seededRandom() * (o - n)) + n;
  };
  _ctor.prototype.randomRange = function (t, e) {
    var o = Math.max(t, e);
    var n = Math.min(t, e);
    return Math.round(Math.random() * (o - n)) + n;
  };
  _ctor.prototype.shuffleArray = function (t) {
    var temp;
    for (var o = t.length - 1; o > 0; o--) {
      var n = Math.floor(this.seededRandom() * (o + 1));
      temp = [t[n], t[o]];
      t[o] = temp[0];
      t[n] = temp[1];
    }
  };
  return cc__decorate([ccp_ccclass], _ctor);
}(cc.Component);
exports.default = def_RankMgr;